Skip to main content

Global Variables

Generally contains functions that were modified to do something different.

Functions

print

print( ... )

Prints text to the chat. Will be always converted to a string so you can pass in anything.

If it is a table. It will convert to be printable and you can see the contents inside.

Arguments:

  • ... [ any[] ] All arguments to send to the chat.

loadstring

loadstring( code, env, bytecodeMode )

Excecutes code from a string, it can also load bytecode!

Note:

Loading bytecode only works in the unsave env!

Arguments:

  • code [ string ] The code to excecute.
  • env [ table ] The code environment.
  • bytecodeMode [ boolean ] Whether you are trying to excecute bytecode or not.

alert

alert( ... )

Same as print but sends it as a alert message.

Arguments:

  • ... [ any[] ] All arguments to send to the alert popup.

tostring

tostring( data )

Like the normal but modified to have additional features like printing lua tables!

Arguments:

  • data [ any ] The variable to convert to be a string.

debug

debug( ... )

The debug function is basically Lua's implementation of the print function in Scrap Mechanic.

Arguments:

  • ... [ any[] ] All arguments to send to the console.

sleep

sleep( time )

Makes the code pause for the specified time at that particular place, maximum wait is 5 seconds.

Arguments:

  • time [ number ] The time to sleep in seconds.